/*
 * @Descripttion:
 * @version:
 * @Author: fei
 * @Date: 2024-11-12 12:00:26
 * @LastEditors: fei
 * @LastEditTime: 2024-11-28 15:06:39
 */
import {
  createBrowserRouter,
  ActionFunction,
  LoaderFunction,
  ShouldRevalidateFunction,
} from "react-router-dom";
import React, { ComponentType, lazy, LazyExoticComponent } from "react";

export interface RouteObject {
  path?: string;
  // index?: boolean;
  children?: RouteObject[];
  caseSensitive?: boolean;
  id?: string;
  loader?: LoaderFunction;
  action?: ActionFunction;
  element?: React.ReactNode | null;
  hydrateFallbackElement?: React.ReactNode | null;
  errorElement?: React.ReactNode | null;
  Component?: LazyExoticComponent<ComponentType<any>>;
  HydrateFallback?: React.ComponentType | null;
  ErrorBoundary?: React.ComponentType | null;
  // handle?: RouteObject["handle"];
  shouldRevalidate?: ShouldRevalidateFunction;
  // lazy?: LazyRouteFunction<RouteObject>;
}
const routes: Array<RouteObject> = [
  {
    path: "/",
    Component: lazy(() => import('../components/Layout/PageLayout')),
    children: [],
  },
  {
    path: "/logins",
    Component: lazy(() => import('@/components/Layout/UserLayout')),
    children: [
      {
        path: "login",
        Component: lazy(() => import('@/pages/logins/Login')),
      },
    ],
  },
  {
    path: "*",
    Component: lazy(() => import('@/pages/logins/Login')),
  },
];
const router = createBrowserRouter(routes as any);
export default router;